<template>
  <div class='container'>
    <el-dialog :visible="showUpDialog" title="预览文章" @close="close">
      <div class="title">
        <h2>{{data.title}}</h2>
        <span>{{data.createTime  | parseTimeByString()}}</span>&nbsp;&nbsp;
        <span>{{data.creator}}</span>&nbsp;&nbsp;
        <span class="el-icon-view"></span>&nbsp;&nbsp;&nbsp;
        <span>{{data.visits}}</span>
      </div>
      <el-card class="box-card"  v-html="data.articleBody">
      </el-card>
    </el-dialog>
  </div>
</template>

<script>
import { detail } from '@/api/hmmm/articles'
export default {
  props: {
    showUpDialog: {
      required: true,
      type: Boolean
    }
  },
  data () {
    return {
      data: {}
    }
  },
  created () {
  },
  methods: {
    async detail (id) {
      const { data } = await detail({ id })
      this.data = data
    },
    close () {
      this.$emit('update:showUpDialog', false)
    }
  }
}
</script>
<style scoped>
.container .title {
  margin-bottom: 20px;
}
.container .box-card {
  background-color:#f5f5f5;
}
</style>
